Skip to content

test(apphost): cover the observability metric sources, manifest file and Prometheus renderer - #7529

Merged
rubenvdlinde merged 2 commits into
developmentfrom
cloud/t04-observability
Nov 9, 2026
Merged

rubenvdlinde merged 2 commits into
developmentfrom
cloud/t04-observability

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

SIG coverage round t1, lane T04: PHP unit tests for AppHost observability.

What this covers

This PR adds new test files only; no production code changes. The new files carry no @covers or #[CoversClass] annotations. phpunit.xml sets beStrictAboutCoverageMetadata=true, and that setting is why the existing MetricsEngine tests record ~0 for these sources: they are marked risky, so their coverage is discarded.

File Before (CI clover, development 30fbb6d) After (subset run)
lib/AppHost/Observability/Source/ObjectMetricSource.php 1/101 101/101
lib/AppHost/Observability/Source/TableMetricSource.php 55/88 88/88
lib/AppHost/Observability/Source/ProviderMetricSource.php 12/20 20/20
lib/AppHost/Observability/BundledManifestFile.php 0/17 16/17
lib/AppHost/Observability/PrometheusRenderer.php 33/36 36/36
Total 101/262 261/262 (99.6%)

Left uncovered: BundledManifestFile.php:76, the file_get_contents false-after-is_readable return. Reaching it needs a production seam, an injectable reader. Forcing that failure in a test raises a PHP warning inside production code, and failOnWarning turns that warning into a failure.

What ran

  • php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/obs.xml --filter '<the 5 new test classes>' tests/Unit/AppHost/Observability: OK (39 tests, 105 assertions), 0 risky. It is a subset run, so the coverage above is a lower bound.
  • weak.php over tests/Unit/AppHost/Observability flags none of the new files.
  • Time-dependent tokens (now, today) are asserted between timestamps taken just before and just after the call, so the tests do not depend on the clock.

Mutation samples (each reverted)

  • mutation: lib/AppHost/Observability/Source/ObjectMetricSource.php:281 $value === 0 || $value === 0.0 -> $value === 0 -> 1 test failed
  • mutation: lib/AppHost/Observability/Source/ObjectMetricSource.php:168 ['ne' => $resolved] -> $resolved -> 1 test failed
  • mutation: lib/AppHost/Observability/Source/ProviderMetricSource.php:104 $sample instanceof MetricSample -> true -> 1 test failed
  • mutation: lib/AppHost/Observability/Source/TableMetricSource.php:233 expr()->lte -> expr()->lt -> 1 test failed
  • mutation: lib/AppHost/Observability/BundledManifestFile.php:51 dropped || is_array($decoded) === false -> 1 test errored
  • mutation: lib/AppHost/Observability/PrometheusRenderer.php:122 '_' . $safeKey -> $safeKey -> 1 test failed

The tests were written with Claude Code.


Generated by Claude Code

…rometheus renderer

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

The red Newman API Test Suite check is not caused by this PR.

It fails at the step "PHPUnit unit suite (in-container, HARD GATE)". That step currently fails on every PR, including JS-only ones such as #7510.

Run Tests Errors Failures Warnings
#7510 (JS-only baseline) 49064 11 11 1
this PR 49103 11 11 1

The 39 extra tests are exactly this PR's new tests, and they all pass. The failing tests are ProcessingLogServiceGoldenTest, SearchReferenceResolverGoldenTest and others that this PR does not touch.

No fix exists yet; it belongs in its own PR. #7519 has the details.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit cb47c4b into development Nov 9, 2026
10 of 11 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 25442c9

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
test-coverage-ratchet ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ 49074/49084 · 19 skipped
Newman ❌ 1625/1628
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-09 14:02 UTC

Download the full PDF report from the workflow artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants